package com.todo.sight.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/18 21:21
 * @description
 */
@Getter
@AllArgsConstructor
public enum PoiBusinessTypeEnum {

    SIGHT(1, "SIGHT", "景点"),
    FOOD(2, "FOOD", "餐馆"),
    TRAFFIC(3, "TRAFFIC", "交通"),

    ;

    private static Map<Integer, PoiBusinessTypeEnum> typeMap = Arrays
            .stream(PoiBusinessTypeEnum.values())
            .collect(Collectors.toMap(PoiBusinessTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static PoiBusinessTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
